<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!DOCTYPE html>
<html>
	<head>
		<link rel="stylesheet" href="<c:url value="css/bootstrap.css" /> " >
		<link rel="stylesheet" href="<c:url value="css/bootstrap-theme.css" /> ">
		<script type="text/javascript" src="<c:url value="js/jquery-2.1.1.js" /> "></script>
		<script type="text/javascript" src="<c:url value="js/bootstrap.js" /> "></script>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Login Page</title>
	</head>
	<body>
		<div class="container">
			 <!-- Static navbar -->
	      <div class="navbar navbar-default" role="navigation">
	        <div class="container-fluid">
	          <div class="navbar-header">
	            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
	              <span class="sr-only">Toggle navigation</span>
	              <span class="icon-bar"></span>
	              <span class="icon-bar"></span>
	              <span class="icon-bar"></span>
	            </button>
	            <a class="navbar-brand" href="index.jsp">JSP Servlet</a>
	          </div>
	          <div class="navbar-collapse collapse">
	            <ul class="nav navbar-nav">
	              <li><a href="index.jsp">Home</a></li>
	              <% if(session.getAttribute("username") != null) { %>
	              <li><a>Welcome <%= session.getAttribute("username") %></a></li>
	              <% } %>
	               <% if(session.getAttribute("username") != null) { %>
	               <li><a href="<c:url value="/profile" /> ">Profile</a></li>
	              <% } %>
	              <% if(session.getAttribute("username") != null) {
	            	  if(session.getAttribute("username").equals("admin")) {
	              %>
	              <li><a href="<c:url value="/listUser" />">List User</a></li>
	              <% } } %>
	              <li><a href="register.jsp">Register</a></li>
	              <% if(session.getAttribute("username") == null) { %>
	              <li class="active"><a href="login.jsp">Login</a></li>
	              <% } %>
	              <% if(session.getAttribute("username") != null) { %>
	              <li><a href="upload.jsp">Upload</a></li>
	              <% } %>
	              <% if(session.getAttribute("username") != null) { %>
	              <li><a href="<c:url value="/download" />">Download</a></li>
	              <% } %>
	              <% if(session.getAttribute("username") != null) { %>
	              <li><a href="<c:url value="/history" />">Your History</a></li>
	              <% } %>
	              <% if(session.getAttribute("username") != null) { %>
	              <li><a href="<c:url value="/logoutServlet" />">Logout</a></li>
	              <% } %>
	            </ul>
	          </div><!--/.nav-collapse -->
	        </div><!--/.container-fluid -->
	      </div>
	      <form class="form-horizontal" role="form" action="loginServlet" method="post">
			  <div class="form-group">
			  <c:if test="${not empty messageLogin}">
			    <div class="alert alert-danger">${messageLogin}</div>
			    </c:if>
			    <label for="inputName" class="col-sm-2 control-label">Name</label>
			    <div class="col-sm-6">
			      <input type="name" class="form-control" name="inputName" id="inputName" placeholder="Name">
			    </div>
			  </div>
			  <div class="form-group">
			    <label for="inputPassword" class="col-sm-2 control-label">Password</label>
			    <div class="col-sm-6">
			      <input type="password" class="form-control" name="inputPassword" id="inputPassword" placeholder="Password">
			    </div>
			  </div>
			  <div class="form-group">
			    <div class="col-sm-offset-2 col-sm-10">
			      <button type="submit" class="btn btn-primary">Login</button>
			    </div>
			  </div>
			</form>
			
			<div class="container">
				<div class="navbar navbar-default navbar-fixed-bottom">
		 		<div  class="container">
		        <p class="navbar-text">&copy; Hai Nguyen| Java Fresher</p>
		        <a href="#" class="navbar-btn  btn btn-danger pull-right"><span class="glyphicon glyphicon-chevron-up"></span> Back To Top</a>
		 		</div>
				</div>
			</div>
		</div> <!-- End Container -->
	</body>
</html>